package Class

import (
	"OnlineRetailers/models/Admin"
	"github.com/astaxie/beego/orm"
)

func GetClass(smallClasses []*Admin.SmallClass) (err error) {

	o := orm.NewOrm()
	sql := "select * from `small_class_classifications` left join `classification` on `classification`.`classification_id`=`small_class_classifications`.`classification_id` where `small_class_classifications`.`small_class_id`=? and `classification`.`show` = 1"
	for _, smallClass := range smallClasses {
		_, err = o.Raw(sql, smallClass.SmallClassId).QueryRows(&smallClass.Classification)

		if err != nil {
			return
		}
	}

	return nil

}
